package com.dd.demo.day12;

import java.util.*;

public class DouDiZhu {
    public static void main(String[] args) {
        HashMap<Integer,String> poker = new HashMap<>();
        ArrayList<Integer> pokerIndex = new ArrayList<>();
        List<String> colors = Arrays.asList("♠","♥","♣","♦");
        List<String> numbers = Arrays.asList("2","A","K","Q","J","10","9","8","7","6","5","4","3");
        int index = 0;
        poker.put(index,"大王");
        pokerIndex.add(index);
        index++;
        poker.put(index,"小王");
        pokerIndex.add(index);
        index++;
        for(String number : numbers){
            for(String color : colors){
                poker.put(index,color+number);
                pokerIndex.add(index);
                index++;
            }
        }
        Collections.shuffle(pokerIndex);
        ArrayList<Integer> player01 = new ArrayList<>();
        ArrayList<Integer> player02 = new ArrayList<>();
        ArrayList<Integer> player03 = new ArrayList<>();
        ArrayList<Integer> dipai = new ArrayList<>();
        for (int i = 0; i < pokerIndex.size(); i++) {
            Integer in = pokerIndex.get(i);
            if(i>=51){
                    dipai.add(in);
            } else if (i%3==0) {
                player01.add(in);
                
            }else if (i%3==1) {
                player02.add(in);
            }else if (i%3==2) {
                player03.add(in);
            }
        }
        Collections.sort(player01);
        Collections.sort(player02);
        Collections.sort(player03);
        Collections.sort(dipai);
        lookPoker("刘德华",poker,player01);
        lookPoker("周润发",poker,player02);
        lookPoker("周星驰",poker,player03);
        lookPoker("底牌",poker,dipai);
    }
    public static void lookPoker(String name,HashMap<Integer,String> poker,ArrayList<Integer> list){
        System.out.println(name+": ");
        for(Integer key : list){
            String value = poker.get(key);
            System.out.println(value+" ");
        }
        System.out.println();
    }
}
